<template>
  <view class="privacy-agreement">
    <rich-text :nodes="richText"></rich-text>
  </view>
</template>

<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { fetchOtherInfo } from '@/api'

const TITLE_MAP = {
  2: '免责声明',
  5: '服务协议'
}
const richText = ref('')

onLoad(e => {
  uni.setNavigationBarTitle({ title: TITLE_MAP[e.id] })
  fetchOtherInfo(e.id).then(res => (richText.value = res))
})
</script>

<style scoped lang="scss">
.privacy-agreement {
  padding: 20rpx;
}
</style>
